#include "common.h"

int maxArea(vector<int>& height)
{
	int n = height.size();
	int right = n - 1;
	int left = 0;
	int ret = 0;
	while (left < right)
	{
		int h = min(height[left], height[right]);
		int l = right - left;
		int t = h * l;
		ret = max(ret, t);
		if (height[left] > height[right])
		{
			right--;
		}
		else
		{
			left++;
		}
	}
	return ret;
}